﻿using System;
using System.Diagnostics.Contracts;

namespace BlindData
{
	public static class NonNegativeGenerator
	{
		/// <summary>
		/// Returns a nonnegative random int.
		/// </summary>
		/// <returns></returns>
		public static int NonNegative(this INext<int> next)
		{
			Contract.Requires(next != null);

			return next.Between(0, int.MaxValue);
		}

		/// <summary>
		/// Returns a nonnegative random long.
		/// </summary>
		/// <returns></returns>
		public static long NonNegative(this INext<long> next)
		{
			Contract.Requires(next != null);

			return next.Between(0, long.MaxValue);
		}

		/// <summary>
		/// Returns a nonnegative random double.
		/// </summary>
		/// <returns></returns>
		public static double NonNegative(this INext<double> next)
		{
			Contract.Requires(next != null);

			return next.Between(0, double.MaxValue);
		}

		/// <summary>
		/// Returns a nonnegative random float.
		/// </summary>
		/// <returns></returns>
		public static float NonNegative(this INext<float> next)
		{
			Contract.Requires(next != null);

			return next.Between(0, float.MaxValue);
		}

		/// <summary>
		/// Returns a nonnegative random decimal.
		/// </summary>
		/// <returns></returns>
		public static decimal NonNegative(this INext<decimal> next)
		{
			Contract.Requires(next != null);

			return next.Between(0, decimal.MaxValue);
		}
	}
}
